import { setToken, removeToken } from '../../utils/cookies.js'
export default {
    state: {
		userInfo:'',
		userpws:[],
        tokne: '',
        Lang: 'zh-Hant',
        // 行情的列表数据
        marketList: [], //期指
        marketGoodsList: [], //现充
        MarketEntity: 'null', //行情详情
        noticeEntity: {}, //公告
    },
    mutations: {
        websocketList(state, data) {
            switch (data.type) {
                case "quotation_list":
                    state.marketList = data.data
                    state.MarketEntity = 'null';
                    break;
                case "quotation_goods_list":
                    state.marketGoodsList = data.data
                    state.MarketEntity = 'null';
                    break;

                case "quotation_detail":
                case "quotation_goods_detail":
                    state.MarketEntity = data.data
                    break;
                case "notice":
                    state.noticeEntity = data.data
                    break;
            }
        },
        settokne(state, data) {
            state.tokne = data
        }
    },
    actions: {
		GETUSERINFO(){
			
		},
        SETTOKNE(context, n) {
            setToken(n)
            context.commit('settokne', n)
        },
        LOGOUT(context, n) {
            removeToken()
        },
        GETWEBSOCKLIST(context, n) {
            context.commit('websocketList', n)
        }
    },
    getters: {}
}